package huawei.js2025;

import java.util.Scanner;

/**
 * 农场施肥 二分查找
 */
public class Question31 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int n = sc.nextInt();

        int[] fields = new int[m];
        for (int i = 0; i < m; i++) {
            fields[i] = sc.nextInt();
        }

        // 永远无法施完
        if (m > n) {
            System.out.println(-1);
            return;
        }

        int min = Integer.MAX_VALUE, max = Integer.MIN_VALUE;
        for (int i = 0; i < m; i++) {
            min = Math.min(min, fields[i]);
            max = Math.max(max, fields[i]);
        }

        while (min < max) {
            int mid = (min + max) / 2;

            int needDay = 0; // 需要天数
            for (int i = 0; i < fields.length; i++) {
                needDay += (int) Math.ceil(((float) fields[i]) / mid);
            }

            if (needDay <= n) {
                max = mid;
            } else {
                min = mid + 1;
            }
        }

        System.out.println(min);

    }

}
